package com.kh.first.service;

import com.kh.first.dao.ProductReportDao;
import com.kh.first.dao.SubordinateDao;
import com.kh.first.dao.WxDepartmentDao;
import com.kh.first.dao.WxUserDao;
import com.kh.first.pojo.ProductReportPojo;
import com.kh.first.pojo.SubordinatePojo;
import com.kh.first.pojo.common.WxDepartment;
import com.kh.first.pojo.common.WxUser;
import com.kh.first.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class ProductReportService {

    @Autowired
    ProductReportDao productReportDao;

    @Autowired
    WxDepartmentDao wxDepartMentDao;
    @Autowired
    WxUserDao wxUserDao;

    @Autowired
    SubordinateDao subordinateDao;

    public Long saveWxUserList(List<WxUser> list) {
        return wxUserDao.saveWxUserList(list);
    }
    public Long saveWxDepartMentList(List<WxDepartment> list) {
        return wxDepartMentDao.saveWxDepartmentList(list);
    }

    public Long saveProductReport(ProductReportPojo productReportPojo) {
        return productReportDao.saveProductReport(productReportPojo);
    }

    public ProductReportPojo getProductReportById(Long id) {
        return productReportDao.getProductReportById(id);
    }

    public List<ProductReportPojo> getProductReportByCreateUserId(String id) {
        return productReportDao.getProductReportByCreateUserId(id);
    }

    public SubordinatePojo adminUserJudge(String id) {
        return subordinateDao.getSubordinateByWorkNo(id);
    }

    public Long updateProductReportById(ProductReportPojo productReportPojo) {
        Long affect = productReportDao.updateProductReportById(productReportPojo);

        return affect;
    }

    public List<ProductReportPojo> getProductReportByIoUser(String userPinYin) {
        return productReportDao.getProductReportByIoUser(userPinYin);
    }

    public List<ProductReportPojo> getProductReportByUserId(String userPinYin) {
        return productReportDao.getProductReportByCreateUserId(userPinYin);
    }
}
